using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_GUARANTORMap : EntityTypeConfiguration<SO_GUARANTOR>
    {
        public SO_GUARANTORMap()
        {
            // Primary Key
            this.HasKey(t => t.CURRENCY);

            // Properties
            this.Property(t => t.ID)
                .HasMaxLength(6);

            this.Property(t => t.NAME)
                .HasMaxLength(60);

            this.Property(t => t.ACCOUNT__)
                .HasMaxLength(20);

            this.Property(t => t.CURRENCY)
                .IsRequired()
                .HasMaxLength(5);

            this.Property(t => t.NOTES)
                .HasMaxLength(250);

            // Table & Column Mappings
            this.ToTable("SO_GUARANTOR");
            this.Property(t => t.ID).HasColumnName("ID");
            this.Property(t => t.NAME).HasColumnName("NAME");
            this.Property(t => t.ACCOUNT__).HasColumnName("ACCOUNT_#");
            this.Property(t => t.CURRENCY).HasColumnName("CURRENCY");
            this.Property(t => t.NOTES).HasColumnName("NOTES");
        }
    }
}
